<nav class="navbar nav-shadow" role="navigation" aria-label="main navigation">
    <div class="container">
        <div class="navbar-brand">
            <a class="navbar-item is-size-5" href="/" style="font-weight: bold">
                消息推送服务
            </a>

            <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
               data-target="mainNavbar">
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
            </a>
        </div>
        <div id="mainNavbar" class="navbar-menu">
            <div class="navbar-start">
                <a class="navbar-item" href="/"> 首页 </a>
                <a class="navbar-item" target="_blank" href="https://github.com/songquanpeng/message-pusher/blob/master/README.md"> 帮助 </a>
                <a class="navbar-item" target="_blank" href="https://iamazing.cn/page/message-pusher"> 关于 </a>
            </div>
            <div class="navbar-end">
                <div class="navbar-item">
                    <div class="buttons">
                        <% if (isLogged) { %>
                            <% if (isAdmin) { %>
                                <a class="button is-light" href="/register">添加新用户</a>
                            <% } %>
                            <a class="button is-light" href="/configure">配置</a>
                            <a class="button is-light" href="/logout">退出</a>
                        <% } else { %>
                            <a class="button is-light" href="/register">注册</a>
                            <a class="button is-light" href="/login">登录</a>
                        <% } %>
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
    if ($navbarBurgers.length > 0) {
      $navbarBurgers.forEach( el => {
        el.addEventListener('click', () => {
          const target = el.dataset.target;
          const $target = document.getElementById(target);
          el.classList.toggle('is-active');
          $target.classList.toggle('is-active');
        });
      });
    }
  });
</script>